home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3589 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: ias_ppp0105.iamerica.net!72274.264
  2. From: 72274.264@compuserve.com (Sergey Kurtsev)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Converting Numbers to English
  5. Date: Wed, 24 Jan 1996 05:43:25 -0500
  6. Organization: Hello, all.
  7. Message-ID: <72274.264.7.003ABDA6@compuserve.com>
  8. References: <4e0pii$grt@mother.usf.edu>
  9. NNTP-Posting-Host: ias_ppp0105.iamerica.net
  10. X-Newsreader: Trumpet for Windows [Version 1.0 Rev B]
  11.  
  12. In article <4e0pii$grt@mother.usf.edu> oneal@suntan.eng.usf.edu (Aaron Oneal) writes:
  13.  
  14. >    Hi all.  I need some kind of algorithm to convert a number like
  15. >240,353,740.23 to English (two hundred forty million, three hundred
  16. >fifty-three thousand, seven hundred forty and twenty-three
  17. >hundredths).  I don't really need code, although it certainly couldn't
  18. >hurt.  I just need a point in the right direction.
  19. >                        Aaron
  20.  
  21.  
  22.   Starting from period and going in left direction separate number in groups 
  23. of 3 digits and write in words 1st digit of 1st group (add "hundred" if 
  24. necessary) then 2nd and 3rd in words. Then continue with 2nd group and etc. 
  25. After period just write using algorithm of the 1st part and add what type 
  26. (tenth, hundredth, etc.)
  27.  
  28.   Hope it's not very scary ?-)
  29.  
  30.   Good luck
  31.